From 68d1d9a7fc08c281174f57b638fa06f7aea73601 Mon Sep 17 00:00:00 2001 From: Dusty Mabe Date: Thu, 1 Jun 2023 09:23:41 -0400 Subject: [PATCH] lib/deploy: skip fallocate call when requested size is 0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit If the requested size is 0 then of course we have enough room 🙂 This avoids the fallocate call returning an EINVAL. Closes: #2869 --- src/libostree/ostree-sysroot-deploy.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c index c5ced04c..d6304734 100644 --- a/src/libostree/ostree-sysroot-deploy.c +++ b/src/libostree/ostree-sysroot-deploy.c @@ -2446,6 +2446,14 @@ get_kernel_layout_size (OstreeSysroot *self, OstreeDeployment *deployment, guint static gboolean dfd_fallocate_check (int dfd, __off_t len, gboolean *out_passed, GError **error) { + /* If the requested size is 0 then return early. Passing a 0 len to + * fallocate results in EINVAL */ + if (len == 0) + { + *out_passed = TRUE; + return TRUE; + } + g_auto (GLnxTmpfile) tmpf = { 0, }; -- 2.30.2